<?php

namespace app\models\jasper;

/**
 * 短信 (SMS)
 * Trait JasperApiSMSTrait
 * @package app\models\jasper
 */
trait JasperApiSmsTrait
{
    /**
     * (通过 SIM 卡 ID)向一个设备发送短信。
     * @param string $sentToIccid
     * @param string $messageText
     * @param int $tpvp
     * @param boolean $tpvpSpecified
     * @param string $messageTextEncoding
     * @return \stdClass
     * @throws \Exception
     */
    public function SendSMS($sentToIccid, $messageText, $tpvp, $tpvpSpecified, $messageTextEncoding)
    {
        return $this->call(
            preg_replace('/.*JasperApi(.*?)Trait/', '$1', __TRAIT__),
            __FUNCTION__,
            [
                'sentToIccid' => $sentToIccid,
                'messageText' => $messageText,
                'tpvp' => $tpvp,
                'tpvpSpecified' => $tpvpSpecified,
                'messageTextEncoding' => $messageTextEncoding,
            ]
        );
    }

    /**
     * (通过 MSISDN)向一个或多个电话号码发送短信。
     * @param string $sentToMsisdn
     * @param string $messageText
     * @param int $tpvp
     * @param boolean $tpvpSpecified
     * @param string $messageTextEncoding
     * @return \stdClass
     * @throws \Exception
     */
    public function SendBulkSMSToMsisdn($sentToMsisdn, $messageText, $tpvp, $tpvpSpecified, $messageTextEncoding)
    {
        return $this->call(
            preg_replace('/.*JasperApi(.*?)Trait/', '$1', __TRAIT__),
            __FUNCTION__,
            [
                'sentToMsisdn' => $sentToMsisdn,
                'messageText' => $messageText,
                'tpvp' => $tpvp,
                'tpvpSpecified' => $tpvpSpecified,
                'messageTextEncoding' => $messageTextEncoding,
            ]
        );
    }

    /**
     * 返回有关一条或多条短信的详细信息。
     * @param int[] $smsMsgIds
     * @param string $messageTextEncoding
     * @return \stdClass
     * @throws \Exception
     */
    public function GetSMSDetails($smsMsgIds, $messageTextEncoding)
    {
        return $this->call(
            preg_replace('/.*JasperApi(.*?)Trait/', '$1', __TRAIT__),
            __FUNCTION__,
            [
                'smsMsgIds' => $smsMsgIds,
                'messageTextEncoding' => $messageTextEncoding,
            ]
        );
    }

    /**
     * 返回某个设备在指定时间段内发出或收到的短信的 ID 列表。
     * @param string $iccid
     * @param integer $fromDate
     * @param boolean $fromDateSpecified
     * @param integer $toDate
     * @param boolean $toDateSpecified
     * @param integer $pageNumber
     * @param boolean $pageNumberSpecified
     * @return \stdClass
     * @throws \Exception
     */
    public function GetModifiedSMS($iccid, $fromDate, $fromDateSpecified, $toDate, $toDateSpecified, $pageNumber, $pageNumberSpecified)
    {
        return $this->call(
            preg_replace('/.*JasperApi(.*?)Trait/', '$1', __TRAIT__),
            __FUNCTION__,
            [
                'iccid' => $iccid,
                'fromDate' => date('c', $fromDate),
                'fromDateSpecified' => $fromDateSpecified,
                'toDate' => date('c', $toDate),
                'toDateSpecified' => $toDateSpecified,
                'pageNumber' => $pageNumber,
                'pageNumberSpecified' => $pageNumberSpecified,
            ]
        );
    }

    /**
     * (通过 SIM 卡 ID)向一个或多个设备发送短信。
     * @param string[] $iccidList
     * @param string $messageText
     * @param integer $tpvp
     * @param boolean $tpvpSpecified
     * @param string $messageTextEncoding
     * @return \stdClass
     * @throws \Exception
     */
    public function SendBulkSMS($iccidList, $messageText, $tpvp, $tpvpSpecified, $messageTextEncoding)
    {
        return $this->call(
            preg_replace('/.*JasperApi(.*?)Trait/', '$1', __TRAIT__),
            __FUNCTION__,
            [
                'iccidList' => $iccidList,
                'messageText' => $messageText,
                'tpvp' => $tpvp,
                'tpvpSpecified' => $tpvpSpecified,
                'messageTextEncoding' => $messageTextEncoding,
            ]
        );
    }

    /**
     * 向一个电话号码发送短信 (MSISDN)。
     * @param string[] $msisdnList
     * @param string $messageText
     * @param integer $tpvp
     * @param boolean $tpvpSpecified
     * @param string $messageTextEncoding
     * @return \stdClass
     * @throws \Exception
     */
    public function SendSMSToMsisdn($msisdnList, $messageText, $tpvp, $tpvpSpecified, $messageTextEncoding)
    {
        return $this->call(
            preg_replace('/.*JasperApi(.*?)Trait/', '$1', __TRAIT__),
            __FUNCTION__,
            [
                'msisdnList' => $msisdnList,
                'messageText' => $messageText,
                'tpvp' => $tpvp,
                'tpvpSpecified' => $tpvpSpecified,
                'messageTextEncoding' => $messageTextEncoding,
            ]
        );
    }
}
